10 REM PRINT TEAM AND BOWLER RECORD SHEETS      (RECORDP)
12 REM Developed by William W. Klaproth,  Moraga Ca.  94556    September 1982
20 REM MASTER FILE DESCRIPTIONS FOR ALL BOWLING PROGRAMS
30 OPEN "B:TEAMS.HDR" AS #1 LEN = 64
40 FIELD #1, 2 AS TM$, 30 AS NAM$, 2 AS RCNT$, 2 AS GAM$, 4 AS PINS$, 2 AS AVG$, 2 AS HIG$, 2 AS HIS$, 4 AS PTSW$, 4 AS PTSL$, 2 AS B1ID$, 2 AS B2ID$, 2 AS B3ID$, 2 AS B4ID$, 2 AS B5ID$
50 FIELD #1, 2 AS HDRID$, 30 AS LEAGUE$, 2 AS WEEKS$, 2 AS TEAMS$, 4 AS FILLER$, 2 AS BWLPERTM$, 2 AS NXTID$, 2 AS HCPBASE$, 4 AS HCPPCNT$
60 OPEN "B:BOWLERS.HDR" AS #2 LEN = 64
70 FIELD #2, 2 AS BBO$, 30 AS BNAM$, 2 AS BRCNT$, 2 AS BGAM$, 4 AS BPINS$, 2 AS BAVG$, 2 AS BHIG$, 2 AS BHIS$, 2 AS BHCP$, 2 AS BHIGH$, 2 AS BHISH$, 2 AS BTM$,2 AS GAM2$, 2 AS SER5$, 2 AS SER6$,2 AS CURSER$,2 AS AVGLSTYR$
80 OPEN "B:TEAM.DET" AS #3 LEN = 16
90 FIELD #3,2 AS DTM$, 2 AS TMO$, 2 AS TDAY$, 2 AS TG1$, 2 AS TG2$, 2 AS TG3$, 2 AS TSER$, 2 AS DPTSW$
100 OPEN "B:BOWLER.DET" AS #4 LEN = 16
110 FIELD #4,2 AS DBO$, 2 AS BMO$, 2 AS BDAY$, 2 AS BG1$, 2 AS BG2$, 2 AS BG3$, 2 AS BSER$
120 REM OPEN "B:HISCORES.DET" AS #5 LEN = 16
130 REM FIELD #5, 2 AS HBNO$, 2 AS HG1$, 2 AS HG2$, 2 AS HG3$, 2 AS HSER$, 1 AS HFLG1$, 1 AS HFLG2$, 1 AS HFLG3$, 1 AS HFLGS$
140 CLS
150 PRINT "TEAM AND BOWLER RECORD SHEET PRINT PROGRAM"
160 PRINT " "
170 INPUT "ENTER DESIRED PRINT OPTION: A=ALL; T=TEAMS; B=BOWLERS; Q=QUIT :",OP$
180 IF OP$ = "A" OR OP$ = "a" GOTO 320
190 IF OP$ = "T" OR OP$ = "t" GOTO 280
200 IF OP$ = "B" OR OP$ = "b" GOTO 240
210 IF OP$ = "Q" OR OP$ = "q" GOTO 420
220 PRINT "INVALID OPTION ENTERED"
230 GOTO 170
240 INPUT "ENTER DESIRED BOWLER NUMBER (999 TO QUIT):",B%
250 IF B% = 999 GOTO 170
260 GOSUB 460
270 GOTO 240
280 INPUT "ENTER DESIRED TEAM NUMBER (99 TO QUIT):",T%
290 IF T% = 99 GOTO 170
300 GOSUB 830
310 GOTO 280
320 GET #1,1
330 TEAMS% = CVI(TEAMS$)
340 BOWLERS% = CVI(BWLPERTM$)
350 MAXBO% = CVI(NXTID$) - 1
360 FOR T% = 1 TO TEAMS%
370 GOSUB 830
380 NEXT T%
390 FOR B% = 1 TO MAXBO%
400 GOSUB 460
410 NEXT B%
420 PRINT "Processing Completed - Returning to MENU"
430 CLOSE
440 RUN "A:MENU"
450 REM SUBROUTINE TO PRINT BOWLER RECORD SHEETS
460 LPRINT "                    BOWLER RECORD SHEET            ";DATE$
470 LPRINT " "
480 GET #2,B%
490 LPRINT BNAM$;"     HIGAM  HISER  HHGAM  HHSER"
500 LPRINT SPC(33);
510 LPRINT USING "   ####";CVI(BHIG$),CVI(BHIS$),CVI(BHIGH$),CVI(BHISH$)
520 LPRINT " "
530 LPRINT "                          GRAND"
540 LPRINT " DATE GAM1 GAM2 GAM3  TOT TOTAL GAM  AVG"
550 LPRINT "----- ---- ---- ----  --- ----- ---  ---"
560 GAM% = 0:PINS = 0
570 FOR TREC% = 1 TO CVI(BRCNT$)
580 REM RANDOMIZING ROUTINE FOR BOWLER DETAIL ADDRESSES
590 X = B% / 2: X% = CINT(X): Y% = X% * 2
600 WREC% = TREC%
610 IF Y% = B% THEN WREC% = TREC% + 50
620 BDET% = X% * 100 + WREC% - 100
630 REM END OF RANDOMIZING ROUTINE
640 GET #4,BDET%
650 G% = 3   'CALCULATE NUMBER OF GAMES BOWLED
660 IF CVI(BG1$) = 0 THEN G% = G% -1
670 IF CVI(BG2$) = 0 THEN G% = G% -1
680 IF CVI(BG3$) = 0 THEN G% = G% -1
690 GAM% = GAM% + G%
700 PINS = PINS + CVI(BSER$)
710 AVG = PINS / GAM%
720 AVG% = INT(AVG)
730 LPRINT USING "##";CVI(BMO$);
740 LPRINT "-";
750 LPRINT USING "## ";CVI(BDAY$);
760 LPRINT USING "#### ";CVI(BG1$),CVI(BG2$),CVI(BG3$),CVI(BSER$);
770 LPRINT USING "##### ";PINS;
780 LPRINT USING "###  ";GAM%,AVG%
790 NEXT TREC%
800 REM LPRINT CHR$(12)
810 RETURN
820 REM SUBROUTINE TO PRINT TEAM RECORD SHEETS
830 LPRINT "                     TEAM RECORD SHEET             ";DATE$
840 LPRINT " "
850 GET #1,T% + 1
860 LPRINT NAM$;"HI GAME:";CVI(HIG$);"   HI SERIES:";CVI(HIS$)
870 LPRINT " "
880 LPRINT "                  SEASON                      GRAND"
890 LPRINT " DATE  WON LOST  WON LOST GAM1 GAM2 GAM3  TOT TOTAL  GAM  AVG"
900 LPRINT "-----  --- ----  --- ---- ---- ---- ----  --- -----  ---  ---"
910 GAM%=0: PINS=0: TGW=0: TGL=0
920 FOR TREC% = 1 TO CVI(RCNT$)
930 REM RANDOMIZING ROUTINE FOR TEAM DETAIL ADDRESSES
940 X = T% / 2: X% = CINT(X): Y% = X% * 2
950 TWREC% = TREC%
960 IF Y% = T% THEN TWREC% = TREC% + 50
970 TDET% = X% * 100 + TWREC% - 100
980 REM END OF RANDOMIZING ROUTINE
990 GET #3,TDET%
1000 LPRINT USING "##";CVI(TMO$);
1010 LPRINT "-";
1020 LPRINT USING "##";CVI(TDAY$);
1030 GW=CVI(DPTSW$)/10: GL=4-GW: TGW=TGW+GW: TGL=TGL+GL
1040 LPRINT USING " ##.#";GW,GL,TGW,TGL;
1050 LPRINT USING " ####";CVI(TG1$),CVI(TG2$),CVI(TG3$),CVI(TSER$);
1060 PINS=PINS+CVI(TSER$): GAM%=GAM%+3: AVG=PINS/GAM%: AVG%=INT(AVG)
1070 LPRINT USING " #####";PINS;
1080 LPRINT USING " ####";GAM%,AVG%
1090 NEXT TREC%
1100 REM LPRINT CHR$(12)
1110 RETURN
